import { $get, $post } from 'sence/modules/request'

// 获取订单详情
export async function getOrderDetail(orderId) {
	let { success, data } = await $get("/order/detail", { orderId });
	if (success) return data
}

// 获取下单时的订单预览详情
export async function getPreviewOrderDetail(skuIds) {
	if (!Array.isArray(skuIds)) skuIds = [skuIds]
	let { success, data } = await $get("/order/preview-order-detail", { skuIds });
	if (success) return data
}

// 创建订单
export async function create(skuId) {
	let { success, data } = await $postB("/order/create", { skuId, count });
	if (success) return data
}

// 获取订单列表
export async function list(skuId) {
	let { success, data } = await $get("/order/list", { skuId, count });
	if (success) return data
}
